import java.util.Scanner;

public class Test {
    //递归求解汉诺塔问题
   public static void   towerOfHanoi(int n,char pos1,char pos2,char pos3){
       if(n==1){
           System.out.print(pos1+"->"+pos3+" ");
           return;
       }
       towerOfHanoi(n-1,pos1,pos3,pos2);
       System.out.print(pos1+"->"+pos3+" ");
       towerOfHanoi(n-1,pos2,pos1,pos3);

   }

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        towerOfHanoi(n,'A','B','C');


    }
}
